Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sending Transmission content with template_id. #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tang8330
Copy link

@Tang8330 Tang8330 commented Oct 27, 2023

Current logic is flawed in 2 ways.

  1. Iterating over a Golang map is not deterministic
  2. Other data types are actually valid to pass into message such as CC and BCC which are map[string]string types. Logic would early return when it found template_id based on [1], but because iterating keys over a map is not deterministic, it would fetch CC and then err out because it's map[string]string not string

@chrsmith
Copy link

chrsmith commented Jan 8, 2024

I came here to report the same problem and propose a similar fix. @Tang8330 were you able to find a workaround so you can reliably send your transmissions? Otherwise calls to transmission.ParseContent(...) will randomly fail. (Due to a map's keys always being returned in an "indeterminate" ordering.)

It seems like the only(?) workaround for using stored templates with Sparkpost is to simply not use this Golang library?

@Tang8330
Copy link
Author

Tang8330 commented Jan 8, 2024

@chrsmith I fixed the problem on my fork and we're using that in Production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants